package com.wz.sort;

public class SelectSort {

	public static void doSort(int... args){
		for (int i = 0; i < args.length; i++) {
			int min = args[i];
			int minIndex = i;
			for (int j = i + 1; j < args.length; j++) {
				if (min > args[j]){
					min = args[j];
					minIndex = j;
				}
			}
			int tmp = args[i];
			args[i] = min;
			args[minIndex] = tmp;
		}
	}

	public static void main(String[] args) {
		int[] a = new int[]{1,4,8,7,6,44,358,112,0,-8};
		doSort(a);
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i]+":");
		}
		System.out.println("");
	}
}